package jpg3.jpg3zad4;

/**
 * Autor: Daniel Michalski
 * Data: 05.07.13
 */

public class Main {
    public static void main(String[] args) throws ExceptionX {
        try {
            wyrzucWyjatek(3);
        } catch (ExceptionX e) {
            System.out.println("1");
            throw new ExceptionX();
        } catch (ExceptionY exceptionY) {
            System.out.println("2");
        } catch (Exception e) {
            System.out.println("3");
        } finally {
            System.out.println("Fi");
        }

    }

    private static void wyrzucWyjatek(int i)
            throws ExceptionX, ExceptionY, Exception {
        if (i == 1)
            throw new ExceptionX();
        if (i == 2)
            throw new ExceptionY();
        if (i == 3)
            throw new Exception();

    }
}


class ExceptionY extends Exception {}

class ExceptionX extends ExceptionY {}